package com.harmontronics.hanma.paas.paas.domain.releasesetup.entity.valueobject;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;

public enum DataBaseTypeEnum {


    POSTGRES("postgres", "org.postgresql.Driver"),
    MYSQL("mysql", "org.mysql.Driver");

    @EnumValue
    @JsonValue
    private String code;
    private String description;

    DataBaseTypeEnum(String code, String description) {
        this.code = code;
        this.description = description;
    }

    DataBaseTypeEnum(String code) {
        this.code = code;
    }

    public static DataBaseTypeEnum of(String code) {
        DataBaseTypeEnum result = null;
        for (DataBaseTypeEnum dataBaseTypeEnum : DataBaseTypeEnum.values()) {
            if (dataBaseTypeEnum.getCode().equalsIgnoreCase(code)) {
                result = dataBaseTypeEnum;
                break;
            }
        }
        return result;
    }


    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }
}
